#ifndef __STMFLASH_H__
#define __STMFLASH_H__
#include "sys.h"   

#define STM32_FLASH_BASE 0x08000000

#define ADDR_FLASH_SECTOR_0     ((u32)0x08000000)
#define ADDR_FLASH_SECTOR_1     ((u32)0x08004000)
#define ADDR_FLASH_SECTOR_2     ((u32)0x08008000)
#define ADDR_FLASH_SECTOR_3     ((u32)0x0800C000)
#define ADDR_FLASH_SECTOR_4     ((u32)0x08010000)
#define ADDR_FLASH_SECTOR_5     ((u32)0x08020000)
#define ADDR_FLASH_SECTOR_6     ((u32)0x08040000)
#define ADDR_FLASH_SECTOR_7     ((u32)0x08060000)
#define ADDR_FLASH_SECTOR_8     ((u32)0x08080000)
#define ADDR_FLASH_SECTOR_9     ((u32)0x080A0000)
#define ADDR_FLASH_SECTOR_10    ((u32)0x080C0000)
#define ADDR_FLASH_SECTOR_11    ((u32)0x080E0000)

void STMFLASH_Unlock(void);
void STMFLASH_Lock(void);
u8 STMFLASH_GetStatus(void);
u8 STMFLASH_WaitDone(u32 time);
u8 STMFLASH_ErasePage(u32 sectoraddr);
u8 STMFLASH_WriteWord(u32 faddr, u32 dat);
u32 STMFLASH_ReadWord(u32 faddr);
void STMFLASH_WriteLenByte(u32 WriteAddr,u32 DataToWrite,u16 Len);
void STMFLASH_Write(u32 WriteAddr,u32 *pBuffer,u32 NumToWrite);
void STMFLASH_Read(u32 ReadAddr,u32 *pBuffer,u32 NumToRead);

#if 1
void hq_flash_param_save(u8* pData);
void hq_flash_param_get(u8* pData);

void hq_flash_sip_fw_one_frame_save(u8* pData, u16 len, u8 frame_no);
void hq_flash_sip_fw_one_frame_get(u8* pData, u16 len, u8 frame_no);
#endif

#endif

